<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

namespace App\Controller;

use App\Constants\User\UserStatusEnum;
use App\Model\User;
use App\Service\Access\UserAccess;
use App\Validator\CommonValidator;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Redis\Redis;
use GuzzleHttp\Client;

class IndexController extends AbstractController
{
        #[Inject]
        protected Redis $redis;

        public function index()
        {
                $user = $this->request->input('user', 'Hyperf');
                $method = $this->request->getMethod();

                //var_export(trans('validator'));
                //(new CommonValidator())->validate($this->request->all(), ['sort', 'page']);
                /*echo PHP_EOL;
                var_export(constantsEnumToIndexArray(ValidatorEnum::cases()));
                echo PHP_EOL;
                echo PHP_EOL;
                var_export(constantsEnumToKeyArray(ValidatorEnum::cases()));
                echo PHP_EOL;
                echo PHP_EOL;*/
                /*var_export(constantsEnumToKeyArray(UserStateEnum::cases()));*/
                //$this->redis->set('a', 'b', 120);
                return [
                        'method' => $method,
                        'message' => "Hello {$user}. yes",
                ];
        }
}
